package cn.edu.qvtu.controller;

import cn.edu.qvtu.util.ApiData;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

//根据编号获得班费信息API接口
@WebServlet("/api/log/info.do")
public class LogByIdController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //处理中文乱码
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("application/json;charset=UTF-8");
        //获得输出对象
        PrintWriter out = resp.getWriter();
        //获取请求参数
        String id = req.getParameter("id");
        //调用业务逻辑层的代码，进行查询操作
        LogsService logsService = new LogsServiceIpml();
        ApiData result = logsService.moneybyid(id);
        //输出结果
        out.println(result);
    }
}
